-
-
Notifications
You must be signed in to change notification settings - Fork 251
Evaluate code in playground #415
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@@ -13,16 +13,16 @@ module Make: (Config: Config) => | |||
include Config | |||
|
|||
module App: { | |||
let postMessage: (worker, fromApp) => unit |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Without these changes I was getting type errors. I posted about it on the forum: https://forum.rescript-lang.org/t/regarding-src-bindings-worker-res-in-the-rescript-lang-org-repo/2004/2
src/common/EvalWorker.res
Outdated
@@ -0,0 +1,10 @@ | |||
// Required because workers may receive messages intended for other workers eg. react dev tools |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, stuck again. This module seems to be being executed inside of the window and not actually in a worker. Very confused at this point...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All of the examples I've seen online in Webpack5 and Next.js are passing URL
instances to new Worker
whereas I am passing url.toString()
, changing it to be let make = () => %raw(
new Worker(new URL("./EvalWorker.mjs", import.meta.url)))
breaks with the following error:
webpack/runtime/compat
The "path" argument must be of type string. Received undefined
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmm, where does path
come from? weird
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I found this issue which seems kinda related but is about dynamic imports inside a worker: vercel/next.js#22581
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That issue is the exact problem and the config workaround does the trick. See my comment here: vercel/next.js#22581 (comment)
Definitely not an ideal solution, I'll look into testing the attached PR and hopefully we can get a patch merged.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, this is definitely fixed with vercel/next.js#26372
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For now I've added a monkey patch in the next config...
Superseded by #875 🎉 |
Closes #414
Eval
module that uses aWorker
under the hood, it exposes a state machine